/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package woowcrawler;

import java.io.BufferedReader;

/**
 *
 * @author Heitor
 */
public class TextCleanner
{

    private String getTextoLimpoEnglish(BufferedReader br)
    {
        String temp = "";
        try
        {
            EnglishStopWord esw = new EnglishStopWord();

            String buf = br.readLine();

            while (buf != null)
            {
                for (Object i : esw.words.toArray())
                {
                    if (buf.contains(" " + i.toString() + " "))
                    {
                        buf = buf.replace(" " + i.toString() + " ", " ");
                    }
                }

                temp += buf;

                buf = br.readLine();
            }
        }
        catch (Exception x)
        {
        }

        return temp;
    }

    private String getTextoLimpoEnglish(String s)
    {
        try
        {
            EnglishStopWord esw = new EnglishStopWord();

            for (Object i : esw.words.toArray())
            {
                if (s.contains(" " + i.toString() + " "))
                {
                    s = s.replace(" " + i.toString() + " ", " ");
                }
            }
        }
        catch (Exception x)
        {
        }

        return s;
    }


    private String getTextoLimpoPortuguese(BufferedReader br)
    {
        String temp = "";
        try
        {
            PortugueseStopWord psw = new PortugueseStopWord();

            String buf = br.readLine();

            while (buf != null)
            {
                for (Object i : psw.words.toArray())
                {
                    if (buf.contains(" " + i.toString() + " "))
                    {
                        buf = buf.replace(" " + i.toString() + " ", " ");
                    }
                }

                temp += buf;

                buf = br.readLine();
            }
        }
        catch (Exception x)
        {
        }

        return temp;
    }

    private String getTextoLimpoPortuguese(String s)
    {
        try
        {
            PortugueseStopWord psw = new PortugueseStopWord();

            for (Object i : psw.words.toArray())
            {
                if (s.contains(" " + i.toString() + " "))
                {
                    s = s.replace(" " + i.toString() + " ", " ");
                }
            }
        }
        catch (Exception x)
        {
        }

        return s;
    }
}
